1 The test cases run against a MSSQL Server 2000 database by default, but due to
\r
2 NHibernate's features, you can change the database to whatever you like.
\r
5 1. Modify the Connection properties information:
\r
7 The basic NHibernate settings can be set as NAnt arguments. See the "How to build.txt"
\r
8 file in the root of the repository for details.
\r
10 See file Castle.ActiveRecord.Tests\Castle.ActiveRecord.Tests.dll.config for full config.
\r
12 2. Create the database schema
\r
17 Test cases will generate all the necessary schema.
\r
20 ** The following schema is only provided for history purposes **
\r
25 CREATE TABLE [dbo].[Entity] (
\r
26 [id] [int] IDENTITY (1, 1) NOT NULL ,
\r
27 [name] [varchar] (50) NULL ,
\r
28 [type] [varchar] (10) NULL
\r
32 CREATE TABLE [dbo].[EntityCompany] (
\r
33 [comp_id] [int] NOT NULL ,
\r
34 [company_type] [tinyint] NOT NULL
\r
38 CREATE TABLE [dbo].[EntityPerson] (
\r
39 [person_id] [int] NOT NULL ,
\r
40 [email] [varchar] (50) NULL ,
\r
41 [phone] [varchar] (12) NULL
\r
45 /****** Object: Table [dbo].[Companies] Script Date: 26/3/2005 12:28:17 ******/
\r
46 CREATE TABLE [dbo].[Companies] (
\r
47 [id] [int] IDENTITY (1, 1) NOT NULL ,
\r
48 [client_of] [int] NULL ,
\r
49 [name] [varchar] (50) NULL ,
\r
50 [type] [varchar] (50) NULL ,
\r
51 [address] [varchar] (50) NULL ,
\r
52 [city] [varchar] (30) NULL ,
\r
53 [state] [varchar] (20) NULL ,
\r
54 [zipcode] [varchar] (12) NULL
\r
58 /****** Object: Table [dbo].[People] Script Date: 26/3/2005 12:28:17 ******/
\r
59 CREATE TABLE [dbo].[People] (
\r
60 [id] [int] IDENTITY (1, 1) NOT NULL ,
\r
61 [name] [varchar] (50) NULL
\r
65 /****** Object: Table [dbo].[PeopleCompanies] Script Date: 26/3/2005 12:28:17 ******/
\r
66 CREATE TABLE [dbo].[PeopleCompanies] (
\r
67 [person_id] [int] NOT NULL ,
\r
68 [company_id] [int] NOT NULL
\r
72 /****** Object: Table [dbo].[Blogs] Script Date: 19/3/2005 23:53:47 ******/
\r
73 CREATE TABLE [dbo].[Blogs] (
\r
74 [id] [int] IDENTITY (1, 1) NOT NULL ,
\r
75 [name] [varchar] (50) NULL ,
\r
76 [author] [varchar] (50) NULL
\r
80 /****** Object: Table [dbo].[Posts] Script Date: 19/3/2005 23:53:49 ******/
\r
81 CREATE TABLE [dbo].[Posts] (
\r
82 [id] [int] IDENTITY (1, 1) NOT NULL ,
\r
83 [title] [varchar] (50) NULL ,
\r
84 [contents] [text] NULL ,
\r
85 [category] [varchar] (50) NULL ,
\r
86 [blogid] [int] NULL ,
\r
87 [created] [datetime] NULL ,
\r
88 [published] [bit] NULL
\r
89 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
\r
92 ALTER TABLE [dbo].[Blogs] WITH NOCHECK ADD
\r
93 CONSTRAINT [PK_Blogs] PRIMARY KEY CLUSTERED
\r
99 ALTER TABLE [dbo].[Posts] WITH NOCHECK ADD
\r
100 CONSTRAINT [PK_Posts] PRIMARY KEY CLUSTERED
\r
106 ALTER TABLE [dbo].[Posts] WITH NOCHECK ADD
\r
107 CONSTRAINT [DF_Posts_post_created] DEFAULT (getdate()) FOR [created],
\r
108 CONSTRAINT [DF_Posts_post_published] DEFAULT (0) FOR [published]
\r
111 ALTER TABLE [dbo].[Posts] ADD
\r
112 CONSTRAINT [FK_Posts_Blogs] FOREIGN KEY
\r
115 ) REFERENCES [dbo].[Blogs] (
\r
117 ) ON DELETE CASCADE ON UPDATE CASCADE
\r
120 CREATE TABLE [dbo].[Award] (
\r
121 [EmployeeID] [int] NOT NULL ,
\r
122 [Description] [varchar] (4000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
\r
126 CREATE TABLE [dbo].[Employee] (
\r
127 [EmployeeID] [int] IDENTITY (1, 1) NOT NULL ,
\r
128 [FirstName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
\r
129 [LastName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
\r
133 ALTER TABLE [dbo].[Award] ADD
\r
134 CONSTRAINT [PK_Award] PRIMARY KEY
\r
140 ALTER TABLE [dbo].[Employee] ADD
\r
141 CONSTRAINT [PK_Person] PRIMARY KEY
\r
147 ALTER TABLE [dbo].[Award] ADD
\r
148 CONSTRAINT [FK_Award_Person] FOREIGN KEY
\r
151 ) REFERENCES [dbo].[Employee] (
\r
153 ) ON UPDATE CASCADE
\r
155 CREATE TABLE [dbo].[order] (
\r
156 OrderID int IDENTITY(1,1) PRIMARY KEY,
\r
157 OrderedDate datetime,
\r
161 CREATE TABLE [dbo].[line_item] (
\r
162 line_number int IDENTITY(1,1),
\r
163 order_id int NOT NULL,
\r
166 PRIMARY KEY (order_id, line_number)
\r
169 CREATE TABLE [dbo].[line_item_non_ident] (
\r
170 line_number int not null unique,
\r
171 order_id int NOT NULL,
\r
174 PRIMARY KEY (order_id, line_number)
\r
177 CREATE TABLE [dbo].[product] (
\r
178 ProductID int IDENTITY(1,1) PRIMARY KEY,
\r
179 serialNumber VARCHAR(255),
\r
184 create table [dbo].[testing_hilo] (
\r
188 -- populate the hilo table.
\r
189 declare @counter int, @sql nvarchar(200)
\r
191 while @counter < 10
\r
193 set @sql = N'insert into [dbo].[testing_hilo] values (' + cast(@counter as nvarchar(4))+ ')'
\r
194 exec sp_executesql @sql
\r
195 set @counter = @counter + 1
\r
198 ALTER TABLE [dbo].[line_item]
\r
199 ADD CONSTRAINT line_itemsFK0 FOREIGN KEY (product_id) REFERENCES [dbo].[product] ON DELETE CASCADE
\r
200 ALTER TABLE [dbo].[line_item]
\r
201 ADD CONSTRAINT line_itemsFK1 FOREIGN KEY (order_id) REFERENCES [dbo].[order] ON DELETE CASCADE
\r
203 ALTER TABLE [dbo].[line_item_non_ident]
\r
204 ADD CONSTRAINT line_items_non_FK0 FOREIGN KEY (product_id) REFERENCES [dbo].[product] ON DELETE CASCADE
\r
205 ALTER TABLE [dbo].[line_item_non_ident]
\r
206 ADD CONSTRAINT line_items_non_FK1 FOREIGN KEY (order_id) REFERENCES [dbo].[order] ON DELETE CASCADE
\r